<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>jquery 标记内容操作</title>
    <script type="text/javascript"  src="http://apps.bdimg.com/libs/jquery/1.11.3/jquery.min.js"> </script>

    <script>
        function showfinish() {
            var x = $("p:last").text();
            alert(x);
            $("input#username").val("your name here");

            var y = $("#container").attr("width");
            alert(y);
            $("#container").attr("width","200px");
            var z = $("#container").attr("width");
            alert(z);

            $("#mainpaper").html("点我咯");
            var q = $("#mainpaper").html();
            alert(q);

            $("#mainpaper").attr("href","jquery测试.html");

            $("p").css("background-color","red");
        }
    </script>
</head>
<body onload="showfinish();">
    <div id="container" width="500px">
        <p>第一段</p>
        <p>第二段</p>
        <input type="text" id="username">
        <a href="http://www.baidu.com" id="mainpaper">click me</a>
        <p>最后一段</p>
    </div>
</body>
</html>